import { $get, $delete } from '@js/request'
import { AccountSchema } from '@components/schema/account'

// 获取部门员工列表
export async function getPersonListRequest (code: string, structureid: string | null, status: number, page: number, limit: number): Promise<{list: AccountSchema[], total: number}> {
  const res = await $get('/api/common/account', {
    tenant_code: code,
    structureid,
    page,
    limit,
    condition: JSON.stringify([{ k: 'status', o: '=', v: status }])
  })
  return res.data
}

// 获取详情
export async function getPersonDetailRequest (id: string): Promise<AccountSchema> {
  const res = await $get(`/api/common/account/${id}`)
  return res.data
}

// 删除账号
export async function deleteAccountRequest (id: string): Promise<void> {
  const res = await $delete(`/api/common/account/${id}`)
  return res.data
}
